﻿<UserControl x:Class="Samba.Modules.MenuModule.DepartmentView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Common="clr-namespace:Samba.Presentation.Common;assembly=Samba.Presentation.Common"
     mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <ScrollViewer Grid.Row="0" Common:KineticBehaviour.HandleKineticScrolling="True" VerticalScrollBarVisibility="Auto">
            <StackPanel>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto">
                        </ColumnDefinition>
                        <ColumnDefinition Width="*">
                        </ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <StackPanel>
                        <Label>
                            <LocText ResourceIdentifierKey="DepartmentName" Suffix=":"/>
                        </Label>
                        <TextBox HorizontalAlignment="Left" MinWidth="200" Text="{Binding Name,Mode=TwoWay}" />
                        <Label>
                            <LocText ResourceIdentifierKey="POSMenu" Suffix=":"/>
                        </Label>
                        <ComboBox HorizontalAlignment="Left" MinWidth="150" ItemsSource="{Binding ScreenMenus}"
                             DisplayMemberPath="Name" SelectedValuePath="Id" SelectedValue="{Binding ScreenMenuId}" />
                        <Label>
                            <LocText ResourceIdentifierKey="TerminalMenu" Suffix=":"/>
                        </Label>
                        <ComboBox HorizontalAlignment="Left" MinWidth="150" ItemsSource="{Binding ScreenMenus}"
                             DisplayMemberPath="Name" SelectedValuePath="Id" SelectedValue="{Binding TerminalScreenMenuId}" />
                        <Label>
                            <LocText ResourceIdentifierKey="POSTableView" Suffix=":"/>
                        </Label>
                        <ComboBox HorizontalAlignment="Left" MinWidth="150" IsEditable="True" ItemsSource="{Binding TableScreens}"
                             DisplayMemberPath="Name" SelectedValuePath="Id" SelectedValue="{Binding TableScreenId,Mode=TwoWay}" />
                        <Label>
                            <LocText ResourceIdentifierKey="TerminalTableView" Suffix=":"/>
                        </Label>
                        <ComboBox HorizontalAlignment="Left" MinWidth="150" IsEditable="True" ItemsSource="{Binding TableScreens}"
                             DisplayMemberPath="Name" SelectedValuePath="Id" SelectedValue="{Binding TerminalTableScreenId}" />
                        <Label>
                            <LocText ResourceIdentifierKey="PriceTag" Suffix=":"/>
                        </Label>
                        <ComboBox HorizontalAlignment="Left" MinWidth="150" IsEditable="True" 
                              ItemsSource="{Binding PriceTags}" Text="{Binding PriceTag}" />
                        <GroupBox Header="{LocText OpenTicketView}"
                             Padding="5" Margin="0,5">
                            <StackPanel>
                                <Label>
                                    <LocText ResourceIdentifierKey="ColumnCount" Suffix=":"/>
                                </Label>
                                <Common:FilteredTextBox Type="Digits" HorizontalAlignment="Left" MinWidth="50" Text="{Binding OpenTicketViewColumnCount,Mode=TwoWay}" />
                                <Label>
                                    <LocText ResourceIdentifierKey="POSDefaultTicketTag" Suffix=":"/>
                                </Label>
                                <ComboBox Text="{Binding DefaultTag}" ItemsSource="{Binding TicketTagGroups}" DisplayMemberPath="Name" HorizontalAlignment="Left" MinWidth="80" IsEditable="True"/>
                                <Label>
                                    <LocText ResourceIdentifierKey="TerminalDefaultTicketTag" Suffix=":"/>
                                </Label>
                                <ComboBox Text="{Binding TerminalDefaultTag}" ItemsSource="{Binding TicketTagGroups}" DisplayMemberPath="Name" HorizontalAlignment="Left" MinWidth="80" IsEditable="True"/>
                            </StackPanel>
                        </GroupBox>
                    </StackPanel>
                    <StackPanel Grid.Column="1" Margin="20,0" HorizontalAlignment="Left">
                        <GroupBox Header="{LocText DepartmentType}"
                             Padding="5">
                            <StackPanel>
                                <CheckBox IsChecked="{Binding IsFastFood}" Margin="0,6">
                                    <LocText ResourceIdentifierKey="FastFood"/>
                                </CheckBox>
                                <CheckBox IsChecked="{Binding IsAlaCarte}" Margin="0,6">
                                    <LocText ResourceIdentifierKey="ALaCarte"/>
                                </CheckBox>
                                <CheckBox IsChecked="{Binding IsTakeAway}" Margin="0,6">
                                    <LocText ResourceIdentifierKey="Delivery"/>
                                </CheckBox>
                            </StackPanel>
                        </GroupBox>
                        <GroupBox Header="{LocText Numerators}" HorizontalAlignment="Left"
                             Padding="5">
                            <UniformGrid>
                                <Label MinWidth="130">
                                    <LocText ResourceIdentifierKey="TicketNumerator" Suffix=":"/>
                                </Label>
                                <ComboBox HorizontalAlignment="Left" MinWidth="170" DisplayMemberPath="Name" ItemsSource="{Binding Numerators}"
                                     SelectedItem="{Binding TicketNumerator}" />
                                <Label MinWidth="130">
                                    <LocText ResourceIdentifierKey="OrderNumerator" Suffix=":"/>
                                </Label>
                                <ComboBox HorizontalAlignment="Left" MinWidth="170" DisplayMemberPath="Name" ItemsSource="{Binding Numerators}"
                                     SelectedItem="{Binding OrderNumerator}" />
                            </UniformGrid>
                        </GroupBox>
                        <GroupBox Header="{LocText TicketTags}" Padding="5">
                            <StackPanel Orientation="Horizontal">
                                <DataGrid ItemsSource="{Binding TicketTagGroups}" SelectedItem="{Binding SelectedTicketTag, Mode=TwoWay}"
                                     HorizontalAlignment="Stretch" GridLinesVisibility="None" RowHeaderWidth="0" Margin="0,3"
                                     AutoGenerateColumns="False" CanUserSortColumns="False" IsReadOnly="True" Background="{StaticResource {x:Static SystemColors.WindowBrushKey}}">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Header="{LocText TagGroups}"
                                             MinWidth="100" Binding="{Binding Name}" />
                                    </DataGrid.Columns>
                                    <DataGrid.ContextMenu>
                                        <ContextMenu>
                                            <MenuItem Command="{Binding AddTicketTagGroupCommand}" Header="{Binding AddTicketTagGroupCommand.Caption}" />
                                            <MenuItem Command="{Binding DeleteTicketTagGroupCommand}" Header="{Binding DeleteTicketTagGroupCommand.Caption}" />
                                        </ContextMenu>
                                    </DataGrid.ContextMenu>
                                </DataGrid>
                                <StackPanel Margin="10">
                                    <TextBlock Margin="2,3">
                                        <Hyperlink Command="{Binding AddTicketTagGroupCommand}">
                                            <TextBlock Text="{Binding Path=AddTicketTagGroupCommand.Caption}" />
                                        </Hyperlink>
                                    </TextBlock>
                                    <TextBlock Margin="2,3">
                                        <Hyperlink Command="{Binding DeleteTicketTagGroupCommand}">
                                            <TextBlock Text="{Binding Path=DeleteTicketTagGroupCommand.Caption}" />
                                        </Hyperlink>
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </GroupBox>
                        <GroupBox Header="{LocText TaxServiceTemplates}" Padding="5">
                            <StackPanel Orientation="Horizontal">
                                <DataGrid ItemsSource="{Binding TaxServiceTemplates}" SelectedItem="{Binding SelectedTaxServiceTemplate, Mode=TwoWay}"
                                     HorizontalAlignment="Stretch" GridLinesVisibility="None" RowHeaderWidth="0" Margin="0,3"
                                     AutoGenerateColumns="False" CanUserSortColumns="False" IsReadOnly="True" Background="{StaticResource {x:Static SystemColors.WindowBrushKey}}">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Header="{LocText TaxServiceTemplate}"
                                             MinWidth="100" Binding="{Binding Name}" />
                                    </DataGrid.Columns>
                                    <DataGrid.ContextMenu>
                                        <ContextMenu>
                                            <MenuItem Command="{Binding AddTaxServiceTemplateCommand}" Header="{Binding AddTaxServiceTemplateCommand.Caption}" />
                                            <MenuItem Command="{Binding DeleteTaxServiceTemplateCommand}" Header="{Binding DeleteTaxServiceTemplateCommand.Caption}" />
                                        </ContextMenu>
                                    </DataGrid.ContextMenu>
                                </DataGrid>
                                <StackPanel Margin="10">
                                    <TextBlock Margin="2,3">
                                        <Hyperlink Command="{Binding AddTaxServiceTemplateCommand}">
                                            <TextBlock Text="{Binding Path=AddTaxServiceTemplateCommand.Caption}" />
                                        </Hyperlink>
                                    </TextBlock>
                                    <TextBlock Margin="2,3">
                                        <Hyperlink Command="{Binding DeleteTaxServiceTemplateCommand}">
                                            <TextBlock Text="{Binding Path=DeleteTaxServiceTemplateCommand.Caption}" />
                                        </Hyperlink>
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </GroupBox>
                    </StackPanel>
                </Grid>
            </StackPanel>
        </ScrollViewer>
        <StackPanel Grid.Row="1">
            <Button HorizontalAlignment="Left" Margin="0,10" MinWidth="70" Content="{Binding SaveCommand.Caption}"
                 Command="{Binding SaveCommand}" />
            <TextBlock Text="{Binding Error}" Foreground="Red" />
        </StackPanel>
    </Grid>
</UserControl>